var tName = 'todo'
var t = document.getElementsByTagName(tName)
riot.tag(tName, t[0].innerHTML, function(opts) {
	var self = this;
	
    self.items = opts.items

    self.edit = function(e) {
      //self.text = e.target.value
    };

    self.add = function(e) {
      if (self.input.value) {
        self.items.push({ title: self.input.value, done: false, hidden: false })
        self.input.value = ''
      }
    };

    self.filter = function(item) {
      return !item.hidden
    };

    self.toggle = function(e) {
      var item = e.item
      item.done = !item.done
      return true
    };
  
});
